using UnityEngine;

namespace HyuFrameWork
{
    /// <summary>
    /// Service 提供通用逻辑，与游戏逻辑不相关
    /// </summary>
    public abstract class ServiceBase : MonoBehaviour, IService 
    {
        protected bool Inited;
        protected virtual bool OnlyInitOnce => true;

        public void Initialize() 
        {
            if (OnlyInitOnce && Inited) return;
            
            OnInitialize();
            
            Inited = true;
        }

        protected virtual void OnInitialize() { }
    }
}
